<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta m_name="generator" content="Doxygen 1.8.14"/>
<meta m_name="viewport" content="width=device-width, initial-scale=1"/>
<title>cpp_redis: includes/cpp_redis/core/subscriber.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="cpp_redis_logo.jpg"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">cpp_redis
   &#160;<span id="projectnumber">4.0.0</span>
   </div>
   <div id="projectbrief">cpp_redis is a C++11 Asynchronous Multi-Platform Lightweight Redis Client, with support for synchronous operations and pipelining.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        m_name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_09e761304027c904456130627fd4dcf5.html">includes</a></li><li class="navelem"><a class="el" href="dir_aabee9b2b90be9a3c8dcec590ad04d13.html">cpp_redis</a></li><li class="navelem"><a class="el" href="dir_4cd0548f4edb17fdac03175eefab51fa.html">core</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">subscriber.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a m_name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">// The MIT License (MIT)</span></div><div class="line"><a m_name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment">//</span></div><div class="line"><a m_name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment">// Copyright (c) 2015-2017 Simon Ninon &lt;simon.ninon@gmail.com&gt;</span></div><div class="line"><a m_name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment">//</span></div><div class="line"><a m_name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment">// Permission is hereby granted, free of charge, to any person obtaining a copy</span></div><div class="line"><a m_name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment">// of this software and associated documentation files (the &quot;Software&quot;), to deal</span></div><div class="line"><a m_name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment">// in the Software without restriction, including without limitation the rights</span></div><div class="line"><a m_name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment">// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell</span></div><div class="line"><a m_name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment">// copies of the Software, and to permit persons to whom the Software is</span></div><div class="line"><a m_name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment">// furnished to do so, subject to the following conditions:</span></div><div class="line"><a m_name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment">//</span></div><div class="line"><a m_name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment">// The above copyright notice and this permission notice shall be included in all</span></div><div class="line"><a m_name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment">// copies or substantial portions of the Software.</span></div><div class="line"><a m_name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment">//</span></div><div class="line"><a m_name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment">// THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</span></div><div class="line"><a m_name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment">// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span></div><div class="line"><a m_name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment">// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE</span></div><div class="line"><a m_name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment">// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span></div><div class="line"><a m_name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment">// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,</span></div><div class="line"><a m_name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment">// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span></div><div class="line"><a m_name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment">// SOFTWARE.</span></div><div class="line"><a m_name="l00022"></a><span class="lineno">   22</span>&#160;</div><div class="line"><a m_name="l00023"></a><span class="lineno">   23</span>&#160;<span class="preprocessor">#pragma once</span></div><div class="line"><a m_name="l00024"></a><span class="lineno">   24</span>&#160;</div><div class="line"><a m_name="l00025"></a><span class="lineno">   25</span>&#160;<span class="preprocessor">#include &lt;atomic&gt;</span></div><div class="line"><a m_name="l00026"></a><span class="lineno">   26</span>&#160;<span class="preprocessor">#include &lt;functional&gt;</span></div><div class="line"><a m_name="l00027"></a><span class="lineno">   27</span>&#160;<span class="preprocessor">#include &lt;map&gt;</span></div><div class="line"><a m_name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor">#include &lt;mutex&gt;</span></div><div class="line"><a m_name="l00029"></a><span class="lineno">   29</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div><div class="line"><a m_name="l00030"></a><span class="lineno">   30</span>&#160;</div><div class="line"><a m_name="l00031"></a><span class="lineno">   31</span>&#160;<span class="preprocessor">#include &lt;cpp_redis/core/sentinel.hpp&gt;</span></div><div class="line"><a m_name="l00032"></a><span class="lineno">   32</span>&#160;<span class="preprocessor">#include &lt;cpp_redis/network/redis_connection.hpp&gt;</span></div><div class="line"><a m_name="l00033"></a><span class="lineno">   33</span>&#160;<span class="preprocessor">#include &lt;cpp_redis/network/tcp_client_iface.hpp&gt;</span></div><div class="line"><a m_name="l00034"></a><span class="lineno">   34</span>&#160;</div><div class="line"><a m_name="l00035"></a><span class="lineno">   35</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacecpp__redis.html">cpp_redis</a> {</div><div class="line"><a m_name="l00036"></a><span class="lineno">   36</span>&#160;</div><div class="line"><a m_name="l00043"></a><span class="lineno"><a class="line" href="classcpp__redis_1_1subscriber.html">   43</a></span>&#160;    <span class="keyword">class </span><a class="code" href="classcpp__redis_1_1subscriber.html">subscriber</a> {</div><div class="line"><a m_name="l00044"></a><span class="lineno">   44</span>&#160;    <span class="keyword">public</span>:</div><div class="line"><a m_name="l00045"></a><span class="lineno">   45</span>&#160;<span class="preprocessor">#ifndef __CPP_REDIS_USE_CUSTOM_TCP_CLIENT</span></div><div class="line"><a m_name="l00046"></a><span class="lineno">   46</span>&#160;</div><div class="line"><a m_name="l00048"></a><span class="lineno">   48</span>&#160;            <a class="code" href="classcpp__redis_1_1subscriber.html#a7a6cf12c6f12fbc54cd80ceaf7ac4cba">subscriber</a>();</div><div class="line"><a m_name="l00049"></a><span class="lineno">   49</span>&#160;</div><div class="line"><a m_name="l00050"></a><span class="lineno">   50</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* __CPP_REDIS_USE_CUSTOM_TCP_CLIENT */</span><span class="preprocessor"></span></div><div class="line"><a m_name="l00051"></a><span class="lineno">   51</span>&#160;</div><div class="line"><a m_name="l00057"></a><span class="lineno">   57</span>&#160;            <span class="keyword">explicit</span> <a class="code" href="classcpp__redis_1_1subscriber.html#a7a6cf12c6f12fbc54cd80ceaf7ac4cba">subscriber</a>(<span class="keyword">const</span> std::shared_ptr&lt;network::tcp_client_iface&gt; &amp;tcp_client);</div><div class="line"><a m_name="l00058"></a><span class="lineno">   58</span>&#160;</div><div class="line"><a m_name="l00060"></a><span class="lineno">   60</span>&#160;            <a class="code" href="classcpp__redis_1_1subscriber.html#a24e54cbec0cc6dcae663cf9399740fe7">~subscriber</a>();</div><div class="line"><a m_name="l00061"></a><span class="lineno">   61</span>&#160;</div><div class="line"><a m_name="l00063"></a><span class="lineno">   63</span>&#160;            <a class="code" href="classcpp__redis_1_1subscriber.html#a7a6cf12c6f12fbc54cd80ceaf7ac4cba">subscriber</a>(<span class="keyword">const</span> <a class="code" href="classcpp__redis_1_1subscriber.html">subscriber</a> &amp;) = <span class="keyword">delete</span>;</div><div class="line"><a m_name="l00064"></a><span class="lineno">   64</span>&#160;</div><div class="line"><a m_name="l00066"></a><span class="lineno">   66</span>&#160;            <a class="code" href="classcpp__redis_1_1subscriber.html">subscriber</a> &amp;<a class="code" href="classcpp__redis_1_1subscriber.html#ac60f83e6e915073bda6853baaeb39485">operator=</a>(<span class="keyword">const</span> <a class="code" href="classcpp__redis_1_1subscriber.html">subscriber</a> &amp;) = <span class="keyword">delete</span>;</div><div class="line"><a m_name="l00067"></a><span class="lineno">   67</span>&#160;</div><div class="line"><a m_name="l00068"></a><span class="lineno">   68</span>&#160;    <span class="keyword">public</span>:</div><div class="line"><a m_name="l00079"></a><span class="lineno"><a class="line" href="classcpp__redis_1_1subscriber.html#afc976757efd9d0ac4def6935546a2338">   79</a></span>&#160;            <span class="keyword">enum class</span> <a class="code" href="classcpp__redis_1_1subscriber.html#afc976757efd9d0ac4def6935546a2338">connect_state</a> {</div><div class="line"><a m_name="l00080"></a><span class="lineno">   80</span>&#160;                    dropped,</div><div class="line"><a m_name="l00081"></a><span class="lineno">   81</span>&#160;                    start,</div><div class="line"><a m_name="l00082"></a><span class="lineno">   82</span>&#160;                    sleeping,</div><div class="line"><a m_name="l00083"></a><span class="lineno">   83</span>&#160;                    ok,</div><div class="line"><a m_name="l00084"></a><span class="lineno">   84</span>&#160;                    failed,</div><div class="line"><a m_name="l00085"></a><span class="lineno">   85</span>&#160;                    lookup_failed,</div><div class="line"><a m_name="l00086"></a><span class="lineno">   86</span>&#160;                    stopped</div><div class="line"><a m_name="l00087"></a><span class="lineno">   87</span>&#160;            };</div><div class="line"><a m_name="l00088"></a><span class="lineno">   88</span>&#160;</div><div class="line"><a m_name="l00089"></a><span class="lineno">   89</span>&#160;    <span class="keyword">public</span>:</div><div class="line"><a m_name="l00091"></a><span class="lineno"><a class="line" href="classcpp__redis_1_1subscriber.html#a7f9e56873e5b96ad9cb2395dadae1a7a">   91</a></span>&#160;            <span class="keyword">typedef</span> std::function&lt;void(const std::string &amp;host, std::size_t port, connect_state status)&gt; <a class="code" href="classcpp__redis_1_1subscriber.html#a7f9e56873e5b96ad9cb2395dadae1a7a">connect_callback_t</a>;</div><div class="line"><a m_name="l00092"></a><span class="lineno">   92</span>&#160;</div><div class="line"><a m_name="l00100"></a><span class="lineno">  100</span>&#160;            <span class="keywordtype">void</span> <a class="code" href="classcpp__redis_1_1subscriber.html#a6ae8134a9a9b31d6f2434ec4f6e86d3a">connect</a>(</div><div class="line"><a m_name="l00101"></a><span class="lineno">  101</span>&#160;                    <span class="keyword">const</span> std::string &amp;host = <span class="stringliteral">&quot;127.0.0.1&quot;</span>,</div><div class="line"><a m_name="l00102"></a><span class="lineno">  102</span>&#160;                    std::size_t port = 6379,</div><div class="line"><a m_name="l00103"></a><span class="lineno">  103</span>&#160;                    <span class="keyword">const</span> <a class="code" href="classcpp__redis_1_1subscriber.html#a7f9e56873e5b96ad9cb2395dadae1a7a">connect_callback_t</a> &amp;connect_callback = <span class="keyword">nullptr</span>,</div><div class="line"><a m_name="l00104"></a><span class="lineno">  104</span>&#160;                    std::uint32_t timeout_ms = 0,</div><div class="line"><a m_name="l00105"></a><span class="lineno">  105</span>&#160;                    std::int32_t max_reconnects = 0,</div><div class="line"><a m_name="l00106"></a><span class="lineno">  106</span>&#160;                    std::uint32_t reconnect_interval_ms = 0);</div><div class="line"><a m_name="l00107"></a><span class="lineno">  107</span>&#160;</div><div class="line"><a m_name="l00114"></a><span class="lineno">  114</span>&#160;            <span class="keywordtype">void</span> <a class="code" href="classcpp__redis_1_1subscriber.html#a6ae8134a9a9b31d6f2434ec4f6e86d3a">connect</a>(</div><div class="line"><a m_name="l00115"></a><span class="lineno">  115</span>&#160;                    <span class="keyword">const</span> std::string &amp;m_name,</div><div class="line"><a m_name="l00116"></a><span class="lineno">  116</span>&#160;                    <span class="keyword">const</span> <a class="code" href="classcpp__redis_1_1subscriber.html#a7f9e56873e5b96ad9cb2395dadae1a7a">connect_callback_t</a> &amp;connect_callback = <span class="keyword">nullptr</span>,</div><div class="line"><a m_name="l00117"></a><span class="lineno">  117</span>&#160;                    std::uint32_t timeout_ms = 0,</div><div class="line"><a m_name="l00118"></a><span class="lineno">  118</span>&#160;                    std::int32_t max_reconnects = 0,</div><div class="line"><a m_name="l00119"></a><span class="lineno">  119</span>&#160;                    std::uint32_t reconnect_interval_ms = 0);</div><div class="line"><a m_name="l00120"></a><span class="lineno">  120</span>&#160;</div><div class="line"><a m_name="l00123"></a><span class="lineno">  123</span>&#160;            <span class="keywordtype">bool</span> <a class="code" href="classcpp__redis_1_1subscriber.html#af73acfc3c1859e6b32bc9a69856e6e59">is_connected</a>() <span class="keyword">const</span>;</div><div class="line"><a m_name="l00124"></a><span class="lineno">  124</span>&#160;</div><div class="line"><a m_name="l00127"></a><span class="lineno">  127</span>&#160;            <span class="keywordtype">void</span> <a class="code" href="classcpp__redis_1_1subscriber.html#aad1d0c3c6edb1522eb7b1bdb64b4705d">disconnect</a>(<span class="keywordtype">bool</span> wait_for_removal = <span class="keyword">false</span>);</div><div class="line"><a m_name="l00128"></a><span class="lineno">  128</span>&#160;</div><div class="line"><a m_name="l00131"></a><span class="lineno">  131</span>&#160;            <span class="keywordtype">bool</span> <a class="code" href="classcpp__redis_1_1subscriber.html#a8df4503f738566d2acab5f080cd44b53">is_reconnecting</a>() <span class="keyword">const</span>;</div><div class="line"><a m_name="l00132"></a><span class="lineno">  132</span>&#160;</div><div class="line"><a m_name="l00134"></a><span class="lineno">  134</span>&#160;            <span class="keywordtype">void</span> <a class="code" href="classcpp__redis_1_1subscriber.html#ae93de179d6ea83ece59cf1a30493c3e9">cancel_reconnect</a>();</div><div class="line"><a m_name="l00135"></a><span class="lineno">  135</span>&#160;</div><div class="line"><a m_name="l00136"></a><span class="lineno">  136</span>&#160;    <span class="keyword">public</span>:</div><div class="line"><a m_name="l00138"></a><span class="lineno"><a class="line" href="classcpp__redis_1_1subscriber.html#a5533ac876d3116911b54ff0dce28f61c">  138</a></span>&#160;            <span class="keyword">typedef</span> std::function&lt;void(reply &amp;)&gt; <a class="code" href="classcpp__redis_1_1subscriber.html#a5533ac876d3116911b54ff0dce28f61c">reply_callback_t</a>;</div><div class="line"><a m_name="l00139"></a><span class="lineno">  139</span>&#160;</div><div class="line"><a m_name="l00146"></a><span class="lineno">  146</span>&#160;            <a class="code" href="classcpp__redis_1_1subscriber.html">subscriber</a> &amp;<a class="code" href="classcpp__redis_1_1subscriber.html#a7b4564fc4dfe356b95aeae4fdb8071c9">auth</a>(<span class="keyword">const</span> std::string &amp;password, <span class="keyword">const</span> <a class="code" href="classcpp__redis_1_1subscriber.html#a5533ac876d3116911b54ff0dce28f61c">reply_callback_t</a> &amp;reply_callback = <span class="keyword">nullptr</span>);</div><div class="line"><a m_name="l00147"></a><span class="lineno">  147</span>&#160;</div><div class="line"><a m_name="l00152"></a><span class="lineno"><a class="line" href="classcpp__redis_1_1subscriber.html#a2ac29261280f488dab483866ae875656">  152</a></span>&#160;            <span class="keyword">typedef</span> std::function&lt;void(const std::string &amp;, const std::string &amp;)&gt; <a class="code" href="classcpp__redis_1_1subscriber.html#a2ac29261280f488dab483866ae875656">read_callback_t</a>;</div><div class="line"><a m_name="l00153"></a><span class="lineno">  153</span>&#160;</div><div class="line"><a m_name="l00158"></a><span class="lineno"><a class="line" href="classcpp__redis_1_1subscriber.html#a19ea39dfabeb19937a9ce4c8d21781b4">  158</a></span>&#160;            <span class="keyword">typedef</span> std::function&lt;void(int64_t)&gt; <a class="code" href="classcpp__redis_1_1subscriber.html#a19ea39dfabeb19937a9ce4c8d21781b4">acknowledgement_callback_t</a>;</div><div class="line"><a m_name="l00159"></a><span class="lineno">  159</span>&#160;</div><div class="line"><a m_name="l00171"></a><span class="lineno">  171</span>&#160;            <a class="code" href="classcpp__redis_1_1subscriber.html">subscriber</a> &amp;<a class="code" href="classcpp__redis_1_1subscriber.html#afee579c702182041645a3d3c55de4b9e">subscribe</a>(<span class="keyword">const</span> std::string &amp;channel, <span class="keyword">const</span> <a class="code" href="classcpp__redis_1_1subscriber.html#a2ac29261280f488dab483866ae875656">read_callback_t</a> &amp;callback,</div><div class="line"><a m_name="l00172"></a><span class="lineno">  172</span>&#160;                                  <span class="keyword">const</span> <a class="code" href="classcpp__redis_1_1subscriber.html#a19ea39dfabeb19937a9ce4c8d21781b4">acknowledgement_callback_t</a> &amp;acknowledgement_callback = <span class="keyword">nullptr</span>);</div><div class="line"><a m_name="l00173"></a><span class="lineno">  173</span>&#160;</div><div class="line"><a m_name="l00185"></a><span class="lineno">  185</span>&#160;            <a class="code" href="classcpp__redis_1_1subscriber.html">subscriber</a> &amp;<a class="code" href="classcpp__redis_1_1subscriber.html#a52605edb2a85d370680c3c9e1b84fc3b">psubscribe</a>(<span class="keyword">const</span> std::string &amp;pattern, <span class="keyword">const</span> <a class="code" href="classcpp__redis_1_1subscriber.html#a2ac29261280f488dab483866ae875656">read_callback_t</a> &amp;callback,</div><div class="line"><a m_name="l00186"></a><span class="lineno">  186</span>&#160;                                   <span class="keyword">const</span> <a class="code" href="classcpp__redis_1_1subscriber.html#a19ea39dfabeb19937a9ce4c8d21781b4">acknowledgement_callback_t</a> &amp;acknowledgement_callback = <span class="keyword">nullptr</span>);</div><div class="line"><a m_name="l00187"></a><span class="lineno">  187</span>&#160;</div><div class="line"><a m_name="l00195"></a><span class="lineno">  195</span>&#160;            <a class="code" href="classcpp__redis_1_1subscriber.html">subscriber</a> &amp;<a class="code" href="classcpp__redis_1_1subscriber.html#a08dffea41cfd5914adfa5a966e0ab292">unsubscribe</a>(<span class="keyword">const</span> std::string &amp;channel);</div><div class="line"><a m_name="l00196"></a><span class="lineno">  196</span>&#160;</div><div class="line"><a m_name="l00204"></a><span class="lineno">  204</span>&#160;            <a class="code" href="classcpp__redis_1_1subscriber.html">subscriber</a> &amp;<a class="code" href="classcpp__redis_1_1subscriber.html#a26edc7dcf87ddc8734fac04878ca307a">punsubscribe</a>(<span class="keyword">const</span> std::string &amp;pattern);</div><div class="line"><a m_name="l00205"></a><span class="lineno">  205</span>&#160;</div><div class="line"><a m_name="l00212"></a><span class="lineno">  212</span>&#160;            <a class="code" href="classcpp__redis_1_1subscriber.html">subscriber</a> &amp;<a class="code" href="classcpp__redis_1_1subscriber.html#af78a5542315daac42998809eeec30eef">commit</a>();</div><div class="line"><a m_name="l00213"></a><span class="lineno">  213</span>&#160;</div><div class="line"><a m_name="l00214"></a><span class="lineno">  214</span>&#160;    <span class="keyword">public</span>:</div><div class="line"><a m_name="l00222"></a><span class="lineno">  222</span>&#160;            <span class="keywordtype">void</span> <a class="code" href="classcpp__redis_1_1subscriber.html#a2faf9e9cc9c95e3c0fed148355af84f1">add_sentinel</a>(<span class="keyword">const</span> std::string &amp;host, std::size_t port, std::uint32_t timeout_ms = 0);</div><div class="line"><a m_name="l00223"></a><span class="lineno">  223</span>&#160;</div><div class="line"><a m_name="l00229"></a><span class="lineno">  229</span>&#160;            <span class="keyword">const</span> <a class="code" href="classcpp__redis_1_1sentinel.html">sentinel</a> &amp;<a class="code" href="classcpp__redis_1_1subscriber.html#a0a6212dfba0513508fdc6377f83a0048">get_sentinel</a>() <span class="keyword">const</span>;</div><div class="line"><a m_name="l00230"></a><span class="lineno">  230</span>&#160;</div><div class="line"><a m_name="l00237"></a><span class="lineno">  237</span>&#160;            <a class="code" href="classcpp__redis_1_1sentinel.html">sentinel</a> &amp;<a class="code" href="classcpp__redis_1_1subscriber.html#a0a6212dfba0513508fdc6377f83a0048">get_sentinel</a>();</div><div class="line"><a m_name="l00238"></a><span class="lineno">  238</span>&#160;</div><div class="line"><a m_name="l00242"></a><span class="lineno">  242</span>&#160;            <span class="keywordtype">void</span> <a class="code" href="classcpp__redis_1_1subscriber.html#a3f8119bc43a67f8e22369aad529444ba">clear_sentinels</a>();</div><div class="line"><a m_name="l00243"></a><span class="lineno">  243</span>&#160;</div><div class="line"><a m_name="l00244"></a><span class="lineno">  244</span>&#160;    <span class="keyword">private</span>:</div><div class="line"><a m_name="l00248"></a><span class="lineno">  248</span>&#160;            <span class="keyword">struct </span>callback_holder {</div><div class="line"><a m_name="l00249"></a><span class="lineno">  249</span>&#160;                    <a class="code" href="classcpp__redis_1_1subscriber.html#a2ac29261280f488dab483866ae875656">read_callback_t</a> read_callback;</div><div class="line"><a m_name="l00250"></a><span class="lineno">  250</span>&#160;                    <a class="code" href="classcpp__redis_1_1subscriber.html#a19ea39dfabeb19937a9ce4c8d21781b4">acknowledgement_callback_t</a> acknowledgement_callback;</div><div class="line"><a m_name="l00251"></a><span class="lineno">  251</span>&#160;            };</div><div class="line"><a m_name="l00252"></a><span class="lineno">  252</span>&#160;</div><div class="line"><a m_name="l00253"></a><span class="lineno">  253</span>&#160;    <span class="keyword">private</span>:</div><div class="line"><a m_name="l00260"></a><span class="lineno">  260</span>&#160;            <span class="keywordtype">void</span> connection_receive_handler(<a class="code" href="classcpp__redis_1_1network_1_1redis__connection.html">network::redis_connection</a> &amp;connection, <a class="code" href="classcpp__redis_1_1reply.html">reply</a> &amp;<a class="code" href="classcpp__redis_1_1reply.html">reply</a>);</div><div class="line"><a m_name="l00261"></a><span class="lineno">  261</span>&#160;</div><div class="line"><a m_name="l00267"></a><span class="lineno">  267</span>&#160;            <span class="keywordtype">void</span> connection_disconnection_handler(<a class="code" href="classcpp__redis_1_1network_1_1redis__connection.html">network::redis_connection</a> &amp;connection);</div><div class="line"><a m_name="l00268"></a><span class="lineno">  268</span>&#160;</div><div class="line"><a m_name="l00275"></a><span class="lineno">  275</span>&#160;            <span class="keywordtype">void</span> handle_acknowledgement_reply(<span class="keyword">const</span> std::vector&lt;reply&gt; &amp;<a class="code" href="classcpp__redis_1_1reply.html">reply</a>);</div><div class="line"><a m_name="l00276"></a><span class="lineno">  276</span>&#160;</div><div class="line"><a m_name="l00283"></a><span class="lineno">  283</span>&#160;            <span class="keywordtype">void</span> read_reply_handler(<span class="keyword">const</span> std::vector&lt;reply&gt; &amp;<a class="code" href="classcpp__redis_1_1reply.html">reply</a>);</div><div class="line"><a m_name="l00284"></a><span class="lineno">  284</span>&#160;</div><div class="line"><a m_name="l00291"></a><span class="lineno">  291</span>&#160;            <span class="keywordtype">void</span> handle_psubscribe_reply(<span class="keyword">const</span> std::vector&lt;reply&gt; &amp;<a class="code" href="classcpp__redis_1_1reply.html">reply</a>);</div><div class="line"><a m_name="l00292"></a><span class="lineno">  292</span>&#160;</div><div class="line"><a m_name="l00301"></a><span class="lineno">  301</span>&#160;            <span class="keywordtype">void</span></div><div class="line"><a m_name="l00302"></a><span class="lineno">  302</span>&#160;            call_acknowledgement_callback(<span class="keyword">const</span> std::string &amp;channel, <span class="keyword">const</span> std::map&lt;std::string, callback_holder&gt; &amp;channels,</div><div class="line"><a m_name="l00303"></a><span class="lineno">  303</span>&#160;                                          std::mutex &amp;channels_mtx, int64_t nb_chans);</div><div class="line"><a m_name="l00304"></a><span class="lineno">  304</span>&#160;</div><div class="line"><a m_name="l00305"></a><span class="lineno">  305</span>&#160;    <span class="keyword">private</span>:</div><div class="line"><a m_name="l00310"></a><span class="lineno">  310</span>&#160;            <span class="keywordtype">void</span> reconnect();</div><div class="line"><a m_name="l00311"></a><span class="lineno">  311</span>&#160;</div><div class="line"><a m_name="l00315"></a><span class="lineno">  315</span>&#160;            <span class="keywordtype">void</span> re_auth();</div><div class="line"><a m_name="l00316"></a><span class="lineno">  316</span>&#160;</div><div class="line"><a m_name="l00320"></a><span class="lineno">  320</span>&#160;            <span class="keywordtype">void</span> re_subscribe();</div><div class="line"><a m_name="l00321"></a><span class="lineno">  321</span>&#160;</div><div class="line"><a m_name="l00325"></a><span class="lineno">  325</span>&#160;            <span class="keywordtype">bool</span> should_reconnect() <span class="keyword">const</span>;</div><div class="line"><a m_name="l00326"></a><span class="lineno">  326</span>&#160;</div><div class="line"><a m_name="l00330"></a><span class="lineno">  330</span>&#160;            <span class="keywordtype">void</span> sleep_before_next_reconnect_attempt();</div><div class="line"><a m_name="l00331"></a><span class="lineno">  331</span>&#160;</div><div class="line"><a m_name="l00335"></a><span class="lineno">  335</span>&#160;            <span class="keywordtype">void</span> clear_subscriptions();</div><div class="line"><a m_name="l00336"></a><span class="lineno">  336</span>&#160;</div><div class="line"><a m_name="l00337"></a><span class="lineno">  337</span>&#160;    <span class="keyword">private</span>:</div><div class="line"><a m_name="l00346"></a><span class="lineno">  346</span>&#160;            <span class="keywordtype">void</span> unprotected_read(<span class="keyword">const</span> std::string &amp;channel, <span class="keyword">const</span> <a class="code" href="classcpp__redis_1_1subscriber.html#a2ac29261280f488dab483866ae875656">read_callback_t</a> &amp;callback,</div><div class="line"><a m_name="l00347"></a><span class="lineno">  347</span>&#160;                                       <span class="keyword">const</span> <a class="code" href="classcpp__redis_1_1subscriber.html#a19ea39dfabeb19937a9ce4c8d21781b4">acknowledgement_callback_t</a> &amp;acknowledgement_callback);</div><div class="line"><a m_name="l00348"></a><span class="lineno">  348</span>&#160;</div><div class="line"><a m_name="l00357"></a><span class="lineno">  357</span>&#160;            <span class="keywordtype">void</span> unprotected_psubscribe(<span class="keyword">const</span> std::string &amp;pattern, <span class="keyword">const</span> <a class="code" href="classcpp__redis_1_1subscriber.html#a2ac29261280f488dab483866ae875656">read_callback_t</a> &amp;callback,</div><div class="line"><a m_name="l00358"></a><span class="lineno">  358</span>&#160;                                        <span class="keyword">const</span> <a class="code" href="classcpp__redis_1_1subscriber.html#a19ea39dfabeb19937a9ce4c8d21781b4">acknowledgement_callback_t</a> &amp;acknowledgement_callback);</div><div class="line"><a m_name="l00359"></a><span class="lineno">  359</span>&#160;</div><div class="line"><a m_name="l00360"></a><span class="lineno">  360</span>&#160;    <span class="keyword">private</span>:</div><div class="line"><a m_name="l00364"></a><span class="lineno">  364</span>&#160;            std::string m_redis_server;</div><div class="line"><a m_name="l00368"></a><span class="lineno">  368</span>&#160;            std::size_t m_redis_port = 0;</div><div class="line"><a m_name="l00372"></a><span class="lineno">  372</span>&#160;            std::string m_master_name;</div><div class="line"><a m_name="l00376"></a><span class="lineno">  376</span>&#160;            std::string m_password;</div><div class="line"><a m_name="l00377"></a><span class="lineno">  377</span>&#160;</div><div class="line"><a m_name="l00381"></a><span class="lineno">  381</span>&#160;            <a class="code" href="classcpp__redis_1_1network_1_1redis__connection.html">network::redis_connection</a> m_client;</div><div class="line"><a m_name="l00382"></a><span class="lineno">  382</span>&#160;</div><div class="line"><a m_name="l00386"></a><span class="lineno">  386</span>&#160;            <a class="code" href="classcpp__redis_1_1sentinel.html">cpp_redis::sentinel</a> m_sentinel;</div><div class="line"><a m_name="l00387"></a><span class="lineno">  387</span>&#160;</div><div class="line"><a m_name="l00391"></a><span class="lineno">  391</span>&#160;            std::uint32_t m_connect_timeout_ms = 0;</div><div class="line"><a m_name="l00395"></a><span class="lineno">  395</span>&#160;            std::int32_t m_max_reconnects = 0;</div><div class="line"><a m_name="l00399"></a><span class="lineno">  399</span>&#160;            std::int32_t m_current_reconnect_attempts = 0;</div><div class="line"><a m_name="l00403"></a><span class="lineno">  403</span>&#160;            std::uint32_t m_reconnect_interval_ms = 0;</div><div class="line"><a m_name="l00404"></a><span class="lineno">  404</span>&#160;</div><div class="line"><a m_name="l00408"></a><span class="lineno">  408</span>&#160;            std::atomic_bool m_reconnecting;</div><div class="line"><a m_name="l00412"></a><span class="lineno">  412</span>&#160;            std::atomic_bool m_cancel;</div><div class="line"><a m_name="l00413"></a><span class="lineno">  413</span>&#160;</div><div class="line"><a m_name="l00417"></a><span class="lineno">  417</span>&#160;            std::map&lt;std::string, callback_holder&gt; m_subscribed_sessions;</div><div class="line"><a m_name="l00421"></a><span class="lineno">  421</span>&#160;            std::map&lt;std::string, callback_holder&gt; m_psubscribed_channels;</div><div class="line"><a m_name="l00422"></a><span class="lineno">  422</span>&#160;</div><div class="line"><a m_name="l00426"></a><span class="lineno">  426</span>&#160;            <a class="code" href="classcpp__redis_1_1subscriber.html#a7f9e56873e5b96ad9cb2395dadae1a7a">connect_callback_t</a> m_connect_callback;</div><div class="line"><a m_name="l00427"></a><span class="lineno">  427</span>&#160;</div><div class="line"><a m_name="l00431"></a><span class="lineno">  431</span>&#160;            std::mutex m_psubscribed_channels_mutex;</div><div class="line"><a m_name="l00435"></a><span class="lineno">  435</span>&#160;            std::mutex m_subscribed_sessions_mutex;</div><div class="line"><a m_name="l00436"></a><span class="lineno">  436</span>&#160;</div><div class="line"><a m_name="l00440"></a><span class="lineno">  440</span>&#160;            <a class="code" href="classcpp__redis_1_1subscriber.html#a5533ac876d3116911b54ff0dce28f61c">reply_callback_t</a> m_auth_reply_callback;</div><div class="line"><a m_name="l00441"></a><span class="lineno">  441</span>&#160;    };</div><div class="line"><a m_name="l00442"></a><span class="lineno">  442</span>&#160;</div><div class="line"><a m_name="l00443"></a><span class="lineno">  443</span>&#160;} <span class="comment">// namespace cpp_redis</span></div><div class="ttc" id="classcpp__redis_1_1network_1_1redis__connection_html"><div class="ttname"><a href="classcpp__redis_1_1network_1_1redis__connection.html">cpp_redis::network::redis_connection</a></div><div class="ttdef"><b>Definition:</b> redis_connection.hpp:45</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html">cpp_redis::subscriber</a></div><div class="ttdef"><b>Definition:</b> subscriber.hpp:43</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a0a6212dfba0513508fdc6377f83a0048"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a0a6212dfba0513508fdc6377f83a0048">cpp_redis::subscriber::get_sentinel</a></div><div class="ttdeci">const sentinel &amp; get_sentinel() const</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a7f9e56873e5b96ad9cb2395dadae1a7a"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a7f9e56873e5b96ad9cb2395dadae1a7a">cpp_redis::subscriber::connect_callback_t</a></div><div class="ttdeci">std::function&lt; void(const std::string &amp;host, std::size_t port, connect_state status)&gt; connect_callback_t</div><div class="ttdoc">connect handler, called whenever a new connection even occurred </div><div class="ttdef"><b>Definition:</b> subscriber.hpp:91</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a52605edb2a85d370680c3c9e1b84fc3b"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a52605edb2a85d370680c3c9e1b84fc3b">cpp_redis::subscriber::psubscribe</a></div><div class="ttdeci">subscriber &amp; psubscribe(const std::string &amp;pattern, const read_callback_t &amp;callback, const acknowledgement_callback_t &amp;acknowledgement_callback=nullptr)</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_ae93de179d6ea83ece59cf1a30493c3e9"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#ae93de179d6ea83ece59cf1a30493c3e9">cpp_redis::subscriber::cancel_reconnect</a></div><div class="ttdeci">void cancel_reconnect()</div><div class="ttdoc">stop any reconnect in progress </div></div>
<div class="ttc" id="classcpp__redis_1_1reply_html"><div class="ttname"><a href="classcpp__redis_1_1reply.html">cpp_redis::reply</a></div><div class="ttdef"><b>Definition:</b> reply.hpp:37</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a3f8119bc43a67f8e22369aad529444ba"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a3f8119bc43a67f8e22369aad529444ba">cpp_redis::subscriber::clear_sentinels</a></div><div class="ttdeci">void clear_sentinels()</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_ac60f83e6e915073bda6853baaeb39485"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#ac60f83e6e915073bda6853baaeb39485">cpp_redis::subscriber::operator=</a></div><div class="ttdeci">subscriber &amp; operator=(const subscriber &amp;)=delete</div><div class="ttdoc">assignment operator </div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_af78a5542315daac42998809eeec30eef"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#af78a5542315daac42998809eeec30eef">cpp_redis::subscriber::commit</a></div><div class="ttdeci">subscriber &amp; commit()</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a24e54cbec0cc6dcae663cf9399740fe7"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a24e54cbec0cc6dcae663cf9399740fe7">cpp_redis::subscriber::~subscriber</a></div><div class="ttdeci">~subscriber()</div><div class="ttdoc">dtor </div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_af73acfc3c1859e6b32bc9a69856e6e59"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#af73acfc3c1859e6b32bc9a69856e6e59">cpp_redis::subscriber::is_connected</a></div><div class="ttdeci">bool is_connected() const</div><div class="ttdoc">determines client connectivity </div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a7a6cf12c6f12fbc54cd80ceaf7ac4cba"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a7a6cf12c6f12fbc54cd80ceaf7ac4cba">cpp_redis::subscriber::subscriber</a></div><div class="ttdeci">subscriber()</div><div class="ttdoc">ctor </div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a8df4503f738566d2acab5f080cd44b53"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a8df4503f738566d2acab5f080cd44b53">cpp_redis::subscriber::is_reconnecting</a></div><div class="ttdeci">bool is_reconnecting() const</div><div class="ttdoc">determines if reconnect is in progress </div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a19ea39dfabeb19937a9ce4c8d21781b4"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a19ea39dfabeb19937a9ce4c8d21781b4">cpp_redis::subscriber::acknowledgement_callback_t</a></div><div class="ttdeci">std::function&lt; void(int64_t)&gt; acknowledgement_callback_t</div><div class="ttdef"><b>Definition:</b> subscriber.hpp:158</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_afc976757efd9d0ac4def6935546a2338"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#afc976757efd9d0ac4def6935546a2338">cpp_redis::connect_state</a></div><div class="ttdeci">connect_state</div><div class="ttdef"><b>Definition:</b> subscriber.hpp:79</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a2ac29261280f488dab483866ae875656"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a2ac29261280f488dab483866ae875656">cpp_redis::subscriber::read_callback_t</a></div><div class="ttdeci">std::function&lt; void(const std::string &amp;, const std::string &amp;)&gt; read_callback_t</div><div class="ttdef"><b>Definition:</b> subscriber.hpp:152</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a7b4564fc4dfe356b95aeae4fdb8071c9"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a7b4564fc4dfe356b95aeae4fdb8071c9">cpp_redis::subscriber::auth</a></div><div class="ttdeci">subscriber &amp; auth(const std::string &amp;password, const reply_callback_t &amp;reply_callback=nullptr)</div><div class="ttdoc">ability to authenticate on the redis server if necessary this method should not be called repeatedly ...</div></div>
<div class="ttc" id="classcpp__redis_1_1sentinel_html"><div class="ttname"><a href="classcpp__redis_1_1sentinel.html">cpp_redis::sentinel</a></div><div class="ttdef"><b>Definition:</b> sentinel.hpp:40</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a2faf9e9cc9c95e3c0fed148355af84f1"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a2faf9e9cc9c95e3c0fed148355af84f1">cpp_redis::subscriber::add_sentinel</a></div><div class="ttdeci">void add_sentinel(const std::string &amp;host, std::size_t port, std::uint32_t timeout_ms=0)</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_aad1d0c3c6edb1522eb7b1bdb64b4705d"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#aad1d0c3c6edb1522eb7b1bdb64b4705d">cpp_redis::subscriber::disconnect</a></div><div class="ttdeci">void disconnect(bool wait_for_removal=false)</div><div class="ttdoc">disconnect from redis server </div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a26edc7dcf87ddc8734fac04878ca307a"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a26edc7dcf87ddc8734fac04878ca307a">cpp_redis::subscriber::punsubscribe</a></div><div class="ttdeci">subscriber &amp; punsubscribe(const std::string &amp;pattern)</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a08dffea41cfd5914adfa5a966e0ab292"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a08dffea41cfd5914adfa5a966e0ab292">cpp_redis::subscriber::unsubscribe</a></div><div class="ttdeci">subscriber &amp; unsubscribe(const std::string &amp;channel)</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a6ae8134a9a9b31d6f2434ec4f6e86d3a"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a6ae8134a9a9b31d6f2434ec4f6e86d3a">cpp_redis::subscriber::connect</a></div><div class="ttdeci">void connect(const std::string &amp;host=&quot;127.0.0.1&quot;, std::size_t port=6379, const connect_callback_t &amp;connect_callback=nullptr, std::uint32_t timeout_ms=0, std::int32_t max_reconnects=0, std::uint32_t reconnect_interval_ms=0)</div><div class="ttdoc">Connect to redis server. </div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_a5533ac876d3116911b54ff0dce28f61c"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#a5533ac876d3116911b54ff0dce28f61c">cpp_redis::subscriber::reply_callback_t</a></div><div class="ttdeci">std::function&lt; void(reply &amp;)&gt; reply_callback_t</div><div class="ttdoc">reply callback called whenever a reply is received, takes as parameter the received reply ...</div><div class="ttdef"><b>Definition:</b> subscriber.hpp:138</div></div>
<div class="ttc" id="classcpp__redis_1_1subscriber_html_afee579c702182041645a3d3c55de4b9e"><div class="ttname"><a href="classcpp__redis_1_1subscriber.html#afee579c702182041645a3d3c55de4b9e">cpp_redis::subscriber::subscribe</a></div><div class="ttdeci">subscriber &amp; subscribe(const std::string &amp;channel, const read_callback_t &amp;callback, const acknowledgement_callback_t &amp;acknowledgement_callback=nullptr)</div></div>
<div class="ttc" id="namespacecpp__redis_html"><div class="ttname"><a href="namespacecpp__redis.html">cpp_redis</a></div><div class="ttdef"><b>Definition:</b> array_builder.hpp:29</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>
